home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 19 / 8 / DISK1982.ZIP / DISKDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1991-03-15  |  3KB  |  72 lines

  1. {--------------------------------------------------------------------}
  2. {- Before compiling this demo program make sure the Unit Directories-}
  3. {- in the Options, Directories menu specify where to find the       -}
  4. {- FlashPac Units.                                                  -}
  5. {-                                                                  -}
  6. {- Compiler       Directory                                         -}
  7. {- --------       -----------------                                 -}
  8. {-  TP4           A:\TP4                                            -}
  9. {-  TP5           A:\TP5                                            -}
  10. {-  TP55          A:\TP55                                           -}
  11. {-                                                                  -}
  12. {--------------------------------------------------------------------}
  13.  
  14. program testit;
  15. uses crt,dos,FPDisk,FPPrt;
  16. Var
  17.    Buf : Array[1..20000] Of Char;
  18.    Fil : Text;
  19.    FilSize              : LongInt;
  20.    Handle,NBytes,WBytes : Integer;
  21.    Done                 : Boolean;
  22.    Ch                   : Char;
  23.  
  24. Function TestDosErrNo : Boolean;
  25. Begin
  26.    TestDosErrNo := False;
  27.    If (IOResult <> 0) Or (DosErrNo <> 0) Or (CErrCode <> 0) Then Begin
  28.       Writeln('IOResult   = ',IOResult:1);
  29.       Writeln('DosErrNo   = ',DosErrNo:1);
  30.       Writeln('CErrCode   = ',CErrCode:1);
  31.       Writeln('CErrType   = ',CErrType:1);
  32.       Writeln('CErrDrive  = ',CErrDrive:1);
  33.       Writeln('CErrDevice = ',CErrDevice);
  34.       Writeln;
  35.       ResetErrCodes;
  36.       TestDosErrNo := True;
  37.    End;
  38.    Writeln('Press Enter to continue...');
  39.    Readln;
  40. End;
  41.  
  42. begin
  43.       FillChar(Buf,SizeOf(Buf),'A');
  44.       ClrScr;
  45.       SetInt24;
  46.       Writeln('doing createfile');
  47.       CreateFile('a:Test',0,Handle);
  48.       Done := TestDosErrNo;
  49.       Writeln('doing writefile');
  50.       WriteFile(Handle,SizeOf(Buf),Buf,WBytes);
  51.       Done := TestDosErrNo;
  52.       Writeln('doing closefile');
  53.       CloseFile(Handle);
  54.       Done := TestDosErrNo;
  55.       Writeln('doing openfile');
  56.       OpenFile('A:Test',2,Handle);
  57.       Done := TestDosErrNo;
  58.       Writeln('doing FSeek');
  59.       Writeln('FilSize = ',FSeek(Handle,0,15100):1);
  60.       Done := TestDosErrNo;
  61.       Writeln('doing FSeek again...');
  62.       Writeln('FilSize = ',FSeek(Handle,0,0):1);
  63.       Done := TestDosErrNo;
  64.       Writeln('do ReadFile');
  65.       ReadFile(Handle,SizeOf(Buf),Buf,WBytes);
  66.       Done := TestDosErrNo;
  67.       Writeln('Number of bytes read = ',WBytes:1);
  68.       Writeln('do CloseFile');
  69.       CloseFile(Handle);
  70.       Done := TestDosErrNo;
  71. end.
  72.